package com.example;


import com.example.MyReflection.Reflect.ApplicationContext;
import com.example.MyReflection.Service.UserService;
import com.example.MyReflection.Service.impl.UserServiceImpl;
import com.example.MyReflection.bean.User;
import com.example.MyReflection.dao.UserDao;
import com.example.MyReflection.dao.impl.UserDaoImpl;
import com.example.Utils.ScanUtils;

/**
 * @author cc
 * @date 2021/7/30 20:47
 * @Description
 */

public class BootStrap {
    public static void main(String[] args) {
        ApplicationContext<Object> applicationContext = new ApplicationContext<>();
//        applicationContext.initContext();

        applicationContext.initContextByAnnotation();
//        Object bean = applicationContext.getBean(UserService.class);
//        Object dao = applicationContext.getBean(UserDao.class);
//        System.out.println(bean);
//        System.out.println(dao);
        //自动装配
        UserService userService = (UserService) applicationContext.getBean(UserService.class);
        UserDao bean = (UserDao) applicationContext.getBean(UserDao.class);
        User user = new User("12", "s", "dd", 21);
        bean.saveUser(user);
//        System.out.println();
//        userService.regist(12,"ceshi");
    }
}
